.SUFFIXES:
.PHONY: all clean

CXX := clang++
CXXFLAGS := -std=c++11 -Wall -g 
INCLUDE := -Iinclude
LIBS := -lm
TARGET := demo.exe


SRCDIR := src
TESTDIR := test
SRCOBJS := $(patsubst %.cpp, %.o, $(wildcard $(SRCDIR)/*.cpp))
TESTOBJS := $(patsubst %.cpp, %.o, $(wildcard $(TESTDIR)/*.cpp))
OBJS := $(SRCOBJS) $(TESTOBJS)

all: $(TARGET)
	@echo '**************** Start *****************'
	./demo.exe res/ecg_raw.data res/ecg_annotation.data
	@echo '**************** Finish *****************'

$(TARGET): $(OBJS)
	$(CXX) $(CXXFLAGS) $(INCLUDE) $(LIBS) $^ -o $@

$(OBJS): %.o: %.cpp
	$(CXX) $(CXXFLAGS) $(INCLUDE) $< -c -o $@

clean:
	-@rm -f $(TARGET)
	-@rm -f $(OBJS)
	-@rm res/*.new
